﻿#include "GUI.h"
#include "DIALOG.h"
#include "CreateWidget.h"
#include "AppFunction.h"
#include "common_path.h"



PARA_TCB temp_widget[15];


void temp_widget_create(WM_HWIN hParent){

	temp_widget[0].guiTCB.winType = WIDGET_WINDOW;
	temp_widget[0].guiTCB.xPos = 0;
	temp_widget[0].guiTCB.yPos = 0;
	temp_widget[0].guiTCB.xSize = 720;
	temp_widget[0].guiTCB.ySize = 720;
	temp_widget[0].appTCB.funType = GROUP_CONTROL;
	temp_widget[0].appTCB.addrList = 0;
	temp_widget[0].guiTCB.pRedraw = draw_line;
	temp_widget[0].guiTCB.id = GetUniqueID();
	temp_widget[0].pPreviousLayer = NULL;
	temp_widget[0].pNextLayer = NULL;
	temp_widget[0].pParallelNext = &temp_widget[1];
	temp_widget[0].parent = 0;
	temp_widget[0].winLayer = 2;
	temp_widget[0].transparency = 1;
	SetPictureHmem(&temp_widget[0], 0, 0, GetPicturePathHmem(I_DTA_PATH_BGHOME));
	temp_widget[0].guiTCB.specialInfo.occupy[0] = 1234;
	temp_widget[0].guiTCB.specialInfo.encryption.cipherPreperiod = 10;


	temp_widget[1].guiTCB.winType = WIDGET_STATIC_TEXT;
	AddStringToBuffer(temp_widget[1].guiTCB.winName, "室温30℃");
	temp_widget[1].guiTCB.xPos = 290;
	temp_widget[1].guiTCB.yPos = 36;
	temp_widget[1].guiTCB.xSize = 140;
	temp_widget[1].guiTCB.ySize = 40;
	temp_widget[1].appTCB.funType = SWITCH_ACTUATOR;
	temp_widget[1].appTCB.addrList = 0;
	temp_widget[1].guiTCB.id = GetUniqueID();
	temp_widget[1].pPreviousLayer = NULL;
	temp_widget[1].pNextLayer = NULL;
	temp_widget[1].pParallelNext = &temp_widget[2];
	temp_widget[1].parent = NULL;


	temp_widget[2].guiTCB.winType = WIDGET_STATIC_TEXT;
	AddStringToBuffer(temp_widget[2].guiTCB.winName, "℃");
	temp_widget[2].guiTCB.xPos = 390;
	temp_widget[2].guiTCB.yPos = 188;
	temp_widget[2].guiTCB.xSize = 40;
	temp_widget[2].guiTCB.ySize = 40;
	temp_widget[2].appTCB.funType = SWITCH_ACTUATOR;
	temp_widget[2].appTCB.addrList = 0;
	temp_widget[2].guiTCB.id = GetUniqueID();
	temp_widget[2].pPreviousLayer = NULL;
	temp_widget[2].pNextLayer = NULL;
	temp_widget[2].pParallelNext = &temp_widget[3];
	temp_widget[2].parent = NULL;



	temp_widget[3].guiTCB.winType = WIDGET_STATIC_TEXT;
	//strcat(temp_widget[3].guiTCB.winName, "24℃");
	AddStringToBuffer(temp_widget[3].guiTCB.winName, "24");
	temp_widget[3].guiTCB.xPos = 290;
	temp_widget[3].guiTCB.yPos = 160;
	temp_widget[3].guiTCB.xSize = 120;
	temp_widget[3].guiTCB.ySize = 80;
	temp_widget[3].appTCB.funType = SWITCH_ACTUATOR;
	temp_widget[3].appTCB.addrList = 0;
	temp_widget[3].guiTCB.id = GetUniqueID();
	temp_widget[3].guiTCB.pFont = &GUI_FONT_64;
	temp_widget[3].pPreviousLayer = NULL;
	temp_widget[3].pNextLayer = NULL;
	temp_widget[3].pParallelNext = &temp_widget[4];
	temp_widget[3].parent = NULL;




	temp_widget[4].guiTCB.winType = WIDGET_BUTTON;
	//strcat(temp_widget[4].guiTCB.winName, "");
	temp_widget[4].guiTCB.xPos = 0;
	temp_widget[4].guiTCB.yPos = 20;
	temp_widget[4].guiTCB.xSize = 120;
	temp_widget[4].guiTCB.ySize = 120;
	temp_widget[4].appTCB.funType = RETURN_FUNCTION;
	temp_widget[4].appTCB.addrList = 0;
	temp_widget[4].guiTCB.id = GetUniqueID();
	temp_widget[4].pPreviousLayer = NULL;
	temp_widget[4].pNextLayer = NULL;
	temp_widget[4].pParallelNext = &temp_widget[5];
	temp_widget[4].parent = NULL;
	sprintf(temp_widget[4].guiTCB.onPath, "%s", RETURN);
	sprintf(temp_widget[4].guiTCB.offPath, "%s", RETURN);


	temp_widget[5].guiTCB.winType = WIDGET_SLIDE;
	//strcat(temp_widget[5].guiTCB.winName, "");
	temp_widget[5].guiTCB.xPos = 70;
	temp_widget[5].guiTCB.yPos = 300;
	temp_widget[5].guiTCB.xSize = 580;
	temp_widget[5].guiTCB.ySize = 54;
	temp_widget[5].appTCB.funType = SWITCH_ACTUATOR;
	temp_widget[5].appTCB.addrList = 0;
	temp_widget[5].guiTCB.id = GetUniqueID();
	temp_widget[5].guiTCB.specialInfo.slider.useFlag = 1;
	temp_widget[5].guiTCB.specialInfo.slider.rangeStart = 0;
	temp_widget[5].guiTCB.specialInfo.slider.rangeEnd = 4;
	temp_widget[5].guiTCB.specialInfo.slider.thumbWidth = 54;
	temp_widget[5].pPreviousLayer = NULL;
	temp_widget[5].pNextLayer = NULL;
	temp_widget[5].pParallelNext = &temp_widget[6];
	temp_widget[5].parent = NULL;
	sprintf(temp_widget[5].guiTCB.onPath, "%s", DTA_TEMP_SLIDER_BTN);
	sprintf(temp_widget[5].guiTCB.offPath, "%s", DTA_TEMP_SLIDER_BTN);
	ConfigureBitMap(DTA_TEMP_SLIDER, &temp_widget[5].guiTCB.pictureBack, 1);



	temp_widget[6].guiTCB.winType = WIDGET_BUTTON;
	//strcat(temp_widget[6].guiTCB.winName, "");
	temp_widget[6].guiTCB.xPos = 110;
	temp_widget[6].guiTCB.yPos = 160;
	temp_widget[6].guiTCB.xSize = 120;
	temp_widget[6].guiTCB.ySize = 120;
	temp_widget[6].appTCB.funType = SWITCH_ACTUATOR;
	temp_widget[6].appTCB.addrList = 0;
	temp_widget[6].guiTCB.id = GetUniqueID();
	temp_widget[6].pPreviousLayer = NULL;
	temp_widget[6].pNextLayer = NULL;
	temp_widget[6].pParallelNext = &temp_widget[7];
	temp_widget[6].parent = hParent;
	sprintf(temp_widget[6].guiTCB.onPath, "%s", DTA_CON_DEL);
	sprintf(temp_widget[6].guiTCB.offPath, "%s", DTA_CON_DEL);



	temp_widget[7].guiTCB.winType = WIDGET_BUTTON;
	//strcat(temp_widget[7].guiTCB.winName, "");
	temp_widget[7].guiTCB.xPos = 510;
	temp_widget[7].guiTCB.yPos = 160;
	temp_widget[7].guiTCB.xSize = 120;
	temp_widget[7].guiTCB.ySize = 120;
	temp_widget[7].appTCB.funType = SWITCH_ACTUATOR;
	temp_widget[7].appTCB.addrList = 0;
	temp_widget[7].guiTCB.id = GetUniqueID();
	temp_widget[7].pPreviousLayer = NULL;
	temp_widget[7].pNextLayer = NULL;
	temp_widget[7].pParallelNext = &temp_widget[8];
	temp_widget[7].parent = hParent;
	sprintf(temp_widget[7].guiTCB.onPath, "%s", DTA_CON_ADD);
	sprintf(temp_widget[7].guiTCB.offPath, "%s", DTA_CON_ADD);


	temp_widget[8].guiTCB.winType = WIDGET_BUTTON;
	//strcat(temp_widget[8].guiTCB.winName, "");
	temp_widget[8].guiTCB.xPos = 90;
	temp_widget[8].guiTCB.yPos = 420;
	temp_widget[8].guiTCB.xSize = 100;
	temp_widget[8].guiTCB.ySize = 100;
	temp_widget[8].appTCB.funType = SWITCH_ACTUATOR;
	temp_widget[8].appTCB.addrList = 0;
	temp_widget[8].guiTCB.id = GetUniqueID();
	temp_widget[8].pPreviousLayer = NULL;
	temp_widget[8].pNextLayer = NULL;
	temp_widget[8].pParallelNext = &temp_widget[9];
	temp_widget[8].parent = NULL;
	sprintf(temp_widget[8].guiTCB.onPath, "%s", DTA_CON_SWITCH_ON);
	sprintf(temp_widget[8].guiTCB.offPath, "%s", DTA_CON_SWITCH_OFF);


	temp_widget[9].guiTCB.winType = WIDGET_BUTTON;
	//strcat(temp_widget[9].guiTCB.winName, "");
	temp_widget[9].guiTCB.xPos = 310;
	temp_widget[9].guiTCB.yPos = 420;
	temp_widget[9].guiTCB.xSize = 100;
	temp_widget[9].guiTCB.ySize = 100;
	temp_widget[9].appTCB.funType = SWITCH_ACTUATOR;
	temp_widget[9].appTCB.addrList = 0;
	temp_widget[9].guiTCB.id = GetUniqueID();
	temp_widget[9].pPreviousLayer = NULL;
	temp_widget[9].pNextLayer = NULL;
	temp_widget[9].pParallelNext = &temp_widget[10];
	temp_widget[9].parent = NULL;
	sprintf(temp_widget[9].guiTCB.onPath, "%s", DTA_CON_COLD_ON);
	sprintf(temp_widget[9].guiTCB.offPath, "%s", DTA_CON_COLD_OFF);


	temp_widget[10].guiTCB.winType = WIDGET_BUTTON;
	//strcat(temp_widget[10].guiTCB.winName, "");
	temp_widget[10].guiTCB.xPos = 530;
	temp_widget[10].guiTCB.yPos = 420;
	temp_widget[10].guiTCB.xSize = 100;
	temp_widget[10].guiTCB.ySize = 100;
	temp_widget[10].appTCB.funType = SWITCH_ACTUATOR;
	temp_widget[10].appTCB.addrList = 0;
	temp_widget[10].guiTCB.id = GetUniqueID();
	temp_widget[10].pPreviousLayer = NULL;
	temp_widget[10].pNextLayer = NULL;
	temp_widget[10].pParallelNext = &temp_widget[11];
	temp_widget[10].parent = NULL;
	sprintf(temp_widget[10].guiTCB.onPath, "%s", DTA_CON_HEAT_ON);
	sprintf(temp_widget[10].guiTCB.offPath, "%s", DTA_CON_HEAT_OFF);


	temp_widget[11].guiTCB.winType = WIDGET_BUTTON;
	//strcat(temp_widget[11].guiTCB.winName, "");
	temp_widget[11].guiTCB.xPos = 90;
	temp_widget[11].guiTCB.yPos = 560;
	temp_widget[11].guiTCB.xSize = 100;
	temp_widget[11].guiTCB.ySize = 100;
	temp_widget[11].appTCB.funType = SWITCH_ACTUATOR;
	temp_widget[11].appTCB.addrList = 0;
	temp_widget[11].guiTCB.id = GetUniqueID();
	temp_widget[11].pPreviousLayer = NULL;
	temp_widget[11].pNextLayer = NULL;
	temp_widget[11].pParallelNext = &temp_widget[12];
	temp_widget[11].parent = NULL;
	sprintf(temp_widget[11].guiTCB.onPath, "%s", DTA_CON_WET_ON);
	sprintf(temp_widget[11].guiTCB.offPath, "%s", DTA_CON_WET_OFF);


	temp_widget[12].guiTCB.winType = WIDGET_BUTTON;
	//strcat(temp_widget[12].guiTCB.winName, "");
	temp_widget[12].guiTCB.xPos = 310;
	temp_widget[12].guiTCB.yPos = 560;
	temp_widget[12].guiTCB.xSize = 100;
	temp_widget[12].guiTCB.ySize = 100;
	temp_widget[12].appTCB.funType = IO_BUTTON_SENSOR;
	temp_widget[12].appTCB.addrList = 0;
	temp_widget[12].guiTCB.id = GetUniqueID();
	temp_widget[12].pPreviousLayer = NULL;
	temp_widget[12].pNextLayer = NULL;
	temp_widget[12].pParallelNext = &temp_widget[13];
	temp_widget[12].parent = NULL;
	sprintf(temp_widget[12].guiTCB.onPath, "%s", DTA_CON_VENTIL_ON);
	sprintf(temp_widget[12].guiTCB.offPath, "%s", DTA_CON_VENTIL_OFF);


	temp_widget[13].guiTCB.winType = WIDGET_BUTTON;
	//strcat(temp_widget[13].guiTCB.winName, "");
	temp_widget[13].guiTCB.xPos = 530;
	temp_widget[13].guiTCB.yPos = 560;
	temp_widget[13].guiTCB.xSize = 100;
	temp_widget[13].guiTCB.ySize = 100;
	temp_widget[13].appTCB.funType = IO_BUTTON_SENSOR;
	temp_widget[13].appTCB.addrList = 0;
	temp_widget[13].guiTCB.id = GetUniqueID();
	temp_widget[13].pPreviousLayer = NULL;
	temp_widget[13].pNextLayer = NULL;
	temp_widget[13].pParallelNext = NULL;
	temp_widget[13].parent = NULL;
	sprintf(temp_widget[13].guiTCB.onPath, "%s", DTA_CON_AUTO_ON);
	sprintf(temp_widget[13].guiTCB.offPath, "%s", DTA_CON_AUTO_OFF);

	
	Concatenate(temp_widget, 14, 2);
	CreateWidget(&temp_widget[0], hParent, 0);
}


